package com.jzg.jcptadmin.Utils;

import android.content.Context;

import cn.pedant.SweetAlert.SweetAlertDialog;

/**
 * Created by liugl on 2017/1/4.
 */

public class CommonUtil {

    public static void showSingleChoiceDialog(Context mContext,String content){
        new SweetAlertDialog(mContext, SweetAlertDialog.WARNING_TYPE)
                .setTitleText("VIN重复")
                .setContentText(content)
                .setConfirmText("知道了")
                .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
                    @Override
                    public void onClick(final SweetAlertDialog sDialog) {
                        sDialog.dismissWithAnimation();
                    }
                }).show();
    }

    /**
     * 判断数组b是否包含数组a中的所有元素
     * @author zealjiang
     * @time 2016/11/10 18:19
     */
    public static boolean containArray(String[] a, String[] b) {
        boolean flag = false;
        int k = 0;
        /**
         * 统计b中包含a中的元素是否与a的元素个数相同
         */
        if (a.length <= b.length) {
            for (int i = 0; i < a.length; i++) {
                for (int j = 0; j < b.length; j++) {
                    if (a[i].equals(b[j])) {
                        k++;
                        continue;
                    }
                }
            }
        }
        if (k == a.length) {
            flag = true;
        }
        return flag;
    }

}
